<?php
	require_once "View\RegisterView.php";

	
	require_once "Model\UserHandler.php";
	
	require_once "Common\Validation.php";
	
	class RegisterHandler {
		
		//Försöker registrera användaren
		public function ValidateInfo(User $object){
			$validation = new InputValidation();
			
			//Validerar email
			$validationOutput = $validation->IsValidEmail($object->m_email);
			($validationOutput->isValid ? $object->m_email = $validationOutput->feedback :	$error[] = $validationOutput->feedback);
			
			//Validerar förnamn
			$validationOutput = $validation->IsValidStringWithoutHTML($object->m_firstName);
			($validationOutput->isValid ? $object->m_firstName = $validationOutput->feedback :	$error[] = $validationOutput->feedback);
			
			//Validerar efternamn
			$validationOutput = $validation->IsValidStringWithoutHTML($object->m_lastName);
			($validationOutput->isValid ? $object->m_lastName = $validationOutput->feedback :	$error[] = $validationOutput->feedback);
			
			//Validerar personnr
			$validationOutput = $validation->IsValidSocielsecurity($object->m_dateOfBirth);
			($validationOutput->isValid ? $object->m_dateOfBirth = $validationOutput->feedback :	$error[] = $validationOutput->feedback);
			
			//Validerar lösenord
			$validationOutput = $validation->IsValidPassword($object->m_password);
			($validationOutput->isValid ? $object->m_password = $validationOutput->feedback :	$error[] = $validationOutput->feedback);
			
			var_dump($object);
			return TRUE;
	 	}
	}
?>